# Date： 2023/2/22 21:38

# 封装
# 继承
# 多态


class CPU:
    pass

class Disk:
    pass

class Computer:
    def __init__(self, cpu, disk):
        self.cpu = cpu
        self.disk = disk

# (1) 变量的赋值
cpu1=CPU()
cpu2=cpu1
print(cpu1)
print(cpu2)

# （2）类的浅拷贝
print("---------------------  类的浅拷贝  ---------------------")
disk=Disk()         # 创建一个硬盘类的对象
computer = Computer(cpu1,disk)          # 创建一个计算机类的对象

# 浅拷贝
import copy
computer2 = copy.copy(computer)
print(computer, computer.cpu, computer.disk)
print(computer2, computer2.cpu, computer2.disk)


# 深拷贝
print('---------------------  类的深拷贝  -------------------------')
computer3 = copy.deepcopy(computer)
print(computer, computer.cpu, computer.disk)
print(computer3, computer3.cpu, computer3.disk)






